home *** CD-ROM | disk | FTP | other *** search
- @echo OFF
-
- REM FCompact.bat - batch file to compact lots of files into one big one
- REM USAGE FCompact: ResultFile InputFileList
- REM IF argument are not supplied then will prompt for them
-
- REM GET THE NAME OF THE RESULT FILE
- SET RESULT_FILE=%1
- IF NOT "%1"=="" GOTO HAVE_RESULT
- CEnvi printf("Result file name: "); RESULT_FILE = gets();
- :HAVE_RESULT
-
- REM GET THE NAME OF THE SOURCE FILE LIST
- SET SOURCE_FILES=%2
- IF NOT "%2"=="" GOTO HAVE_SOURCE
- CEnvi printf("Source file list name: "); SOURCE_FILES = gets();
- :HAVE_SOURCE
-
- REM CHECK THAT THE SOURCE FILE LIST EXISTS
- IF EXIST %SOURCE_FILES% GOTO SOURCE_IS_OK
- ECHO %SOURCE_FILES% FILE NOT FOUND
- GOTO FINI
- :SOURCE_IS_OK
-
-
- REM START WITH AN EMPTY RESULT FILE
- CEnvi fopen("%RESULT_FILE%","wb");
-
- REM FINALLY USE DOS'S COPY + TO APPEND ALL FILES TOGETHER
- REM DO THIS BY USING SOURCE_FILE AS INPUT TO SHORT CENVI PROGRAM
- REM USE FIRST LINE IF BINARY FILES, SECOND IF TEXT FILES
- REM TYPE %SOURCE_FILES% | CEnvi while (file=gets()) system("copy %%s/B+%%s/B %%s/B",RESULT_FILE,file,RESULT_FILE);
- TYPE %SOURCE_FILES% | CEnvi while (file=gets()) system("copy %%s+%%s %%s",RESULT_FILE,file,RESULT_FILE);
-
- :FINI
- SET RESULT_FILE=
- SET SOURCE_FILES=